﻿function formatTime(timeVal)
{
	var timeHour = Math.round(timeVal / 1000);
	var timeSec = timeHour % 60;
	if( timeSec < 10 )
	timeSec = '0'+timeSec;
	timeHour = (timeHour - timeSec)/60;
	var timeMin = timeHour % 60;
	if( timeMin < 10 )
	timeMin = '0'+timeMin;
	timeHour = (timeHour - timeMin)/60;
	if( timeHour > 0 )
	return timeHour+":"+timeMin+":"+timeSec;
	else
	return timeMin+":"+timeSec;
};
var mPlayerLive = {//直播mediaPlayer播放对象
	Delete:function(){
		try
		{
			if(this.timerRunning)
			{
				clearInterval(this.m_time);
				this.timerRunning = false;
			}
			this.mdivStop.onclick();
			this.player=null;
		}catch(err){}
	},
	Init:function(url,pwidth,pheight){
		if(curPlayer!=null)
		curPlayer.Delete();
		this.playerType="temp.wmv";
		this.isvod = false;
		this.isplay = true;
		this.mdivScreen = document.getElementById("ready");
		this.mdivReady = document.getElementById("stopdiv");
		this.mdivAd = document.getElementById("playing");
		this.mdivTime = document.getElementById("percent");
		this.mdivPlay =document.getElementById("play");
		this.mdivStop = document.getElementById("stop");
		this.mdivInfo = document.getElementById("msg");
		this.mdivSound = document.getElementById("mute");
		this.mdivFullScreen = document.getElementById("fullScreen");
		this.stateStr = ["高清视频技术演示","高清视频技术演示","播放暂停","正在播放《"+channelname+"》","向前搜索","向后搜索","正在缓冲","正在等待流开始","播放流已结束","准备新的媒体文件","播放准备就绪","尝试重新连接流媒体数据"];
		this.m_time=null;
		this.timerRunning = false;
		var str = '';
		str += '<object ID="player" width="'+pwidth+'" height="'+pheight+'" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" VIEWASTEXT>';
		str += '    <param name="AutoStart" value="false">';
		str += '    <param NAME="Balance" VALUE="1">';
		str += '    <param name="enabled" value="1">';
		str += '    <param name="EnableContextMenu" value="true">';
		str += '    <param name="url" value="">';
		str += '    <param name="PlayCount" value="1">';
		str += '    <param name="rate" value="1">';
		str += '    <param name="currentPosition" value="0">';
		str += '    <param name="currentMarker" value="1">';
		str += '    <param name="defaultFrame" value="">';
		str += '    <param name="invokeURLs" value="0">';
		str += '    <param name="baseURL" value="">';
		str += '    <param name="stretchToFit" value="1">';
		str += '    <param name="volume" value="90">';
		str += '    <param name="mute" value="0">';
		str += '    <param name="uiMode" value="None">';
		str += '    <param name="windowlessVideo" value="0">';
		str += '    <param name="fullScreen" value="0">';
		str += '    <param name="enableErrorDialogs" value="0">';
		str += '</object>';
		this.mdivScreen.innerHTML = str;
		this.player =  document.getElementById("player");
		this.player.URL = url;
		//window.setTimeout("this.player.controls.play();", 3000);
		this.player.controls.play();
		this.mdivPlay.style.backgroundPosition='0% -33px';
		try
		{
			this.m_time = setInterval('curPlayer.Monitor()',1000);
			this.timerRunning = true;
		}catch(err){}

		//全屏
		this.mdivFullScreen.onclick=function()
		{
			if(mPlayerLive.player.playState==3)
			{
				mPlayerLive.player.fullScreen = 1;
			}
		}
		//静音
		this.mdivSound.onclick=function()
		{
			if (mPlayerLive.player.settings.mute) {mPlayerLive.mdivSound.style.backgroundPosition='0% -68px';}else{mPlayerLive.mdivSound.style.backgroundPosition='0% -308px';}
			mPlayerLive.player.settings.mute=!mPlayerLive.player.settings.mute;
		}
		//播放
		this.mdivPlay.onclick=function()
		{
			if (!mPlayerLive.isplay)
			{
				try{
					mPlayerLive.ShowMovie(1);//关闭广告画面
					mPlayerLive.mdivPlay.style.backgroundPosition='0% -33px';
					mPlayerLive.player.controls.play();
				}catch(err){}
				return ;
			}
			if(mPlayerLive.mdivPlay.style.backgroundPosition=='0% -33px')
			{
				try{
					mPlayerLive.mdivPlay.style.backgroundPosition='0 0';
					mPlayerLive.player.controls.pause();
				}catch(err){}
			}
			else
			{
				try{
					mPlayerLive.mdivPlay.style.backgroundPosition='0% -33px';
					mPlayerLive.player.controls.play();
				}catch(err){}
			}
		}
		//停止
		this.mdivStop.onclick=function()
		{
			try{
				mFlvPlayer.isplay = false;
				mPlayerLive.mdivPlay.style.backgroundPosition='0 0';
				mPlayerLive.player.controls.stop();
				mPlayerLive.ShowMovie(3);
			}catch(err){}
		}
		//this.SetVolume(curVolumeBar.GetPos());//设置初始声音
		this.mdivTime.innerHTML = "";//播放时间显示
		document.getElementById("ctrlPanel").style.display="block";
		document.getElementById("track").style.display="none";//进度条隐藏
		this.ShowMovie(1);//显示广告画面
	},
	//获取播放状态
	GetStatus:function()
	{
		return this.player.playState;
	},
	//获取总长度
	GetLen:function()
	{
		return curPlayer.player.CurrentMedia.duration*1000;
	},
	//当前播放长度
	GetPos:function()
	{
		return this.player.controls.CurrentPosition*1000;
	},
	//设置播放地址并开始播放
	SetInfo:function(info)
	{
		try{
			this.mdivInfo.innerHTML = info;
		}catch(err){}
	},
	//设置声音
	SetVolume:function(v)
	{
		try{
			this.player.settings.volume=parseInt(v,10);
			return true;
		}catch(err){return false;}
	},
	//是否显示节目画面，true 为显示节目画面，false为显示广告画面
	ShowMovie:function(show)
	{
		if(show==1)
		{
			if (this.mdivReady.style.display != "none")
			{
				this.mdivReady.style.display = "none";
				this.mdivScreen.style.display = "block";
			}
			if(this.mdivAd.style.display!="none")
			{
				this.mdivScreen.style.display = "block";
				this.mdivAd.style.display = "none";
			}
		}
		else if(show ==2)
		{
			if (this.mdivReady.style.display != "none")
			{
				this.mdivReady.style.display = "none";
			}
			if(this.mdivAd.style.display != "block")
			{
				this.mdivScreen.style.display = "none";
				this.mdivAd.style.display = "block";
			}
		}
		else if (show==3)
		{
			this.mdivAd.style.display = "none";
			this.mdivScreen.style.display = "none";
			this.mdivReady.style.display = "block";
		}
	},
	Monitor:function()
	{
		var state = this.GetStatus();
		this.SetInfo(this.stateStr[state])
		if(state==3)
		{
			this.ShowMovie(true);
		}else if(state==1)
		{
			this.mdivAd.className = 'ready';
		}
	}
};
var mPlayerVod = {//直播mediaPlayer播放对象
	Delete:function(){
		try
		{
			if(this.timerRunning)
			{
				clearInterval(this.m_time);
				this.timerRunning = false;
			}
			this.mdivStop.onclick();
			this.player=null;
		}catch(err){}
	},
	Init:function(url,pwidth,pheight){
		if(curPlayer!=null)
		curPlayer.Delete();
		this.playerType="temp.wmv";
		this.isvod = true;
		this.isplay = true;
		this.mdivScreen = document.getElementById("ready");
		this.mdivReady = document.getElementById("stopdiv");
		this.mdivAd = document.getElementById("playing");
		this.mdivTime = document.getElementById("percent");
		this.mdivPlay =document.getElementById("play");
		this.mdivStop = document.getElementById("stop");
		this.mdivInfo = document.getElementById("msg");
		this.mdivSound = document.getElementById("mute");
		this.mdivFullScreen = document.getElementById("fullScreen");
		this.stateStr = ["高清视频技术演示","高清视频技术演示","播放暂停","正在播放《"+channelname+"》","向前搜索","向后搜索","正在缓冲","正在等待流开始","播放流已结束","准备新的媒体文件","播放准备就绪","尝试重新连接流媒体数据"];
		this.m_time=null;
		this.timerRunning = false;
		var str = '';
		str += '<object ID="player" width="'+pwidth+'" height="'+pheight+'" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" VIEWASTEXT>';
		str += '    <param name="AutoStart" value="false">';
		str += '    <param NAME="Balance" VALUE="1">';
		str += '    <param name="enabled" value="1">';
		str += '    <param name="EnableContextMenu" value="true">';
		str += '    <param name="url" value="">';
		str += '    <param name="PlayCount" value="1">';
		str += '    <param name="rate" value="1">';
		str += '    <param name="currentPosition" value="0">';
		str += '    <param name="currentMarker" value="1">';
		str += '    <param name="defaultFrame" value="">';
		str += '    <param name="invokeURLs" value="0">';
		str += '    <param name="baseURL" value="">';
		str += '    <param name="stretchToFit" value="1">';
		str += '    <param name="volume" value="90">';
		str += '    <param name="mute" value="0">';
		str += '    <param name="uiMode" value="None">';
		str += '    <param name="windowlessVideo" value="0">';
		str += '    <param name="fullScreen" value="0">';
		str += '    <param name="enableErrorDialogs" value="0">';
		str += '</object>';
		this.mdivScreen.innerHTML = str;
		this.player =  document.getElementById("player");
		this.player.URL = url;
		this.player.controls.play();
		this.mdivPlay.style.backgroundPosition='0% -33px';
		try
		{
			this.m_time = setInterval('curPlayer.Monitor()',1000);
			this.timerRunning = true;
		}catch(err){}
		//全屏
		this.mdivFullScreen.onclick=function()
		{
			if(mPlayerVod.player.playState==3)
			{
				mPlayerVod.player.fullScreen = 1;
			}
		}
		//静音
		this.mdivSound.onclick=function()
		{
			if (mPlayerVod.player.settings.mute) {mPlayerVod.mdivSound.style.backgroundPosition='0% -68px';}else{mPlayerVod.mdivSound.style.backgroundPosition='0% -308px';}
			mPlayerVod.player.settings.mute=!mPlayerVod.player.settings.mute;
		}
		//播放
		this.mdivPlay.onclick=function()
		{
			if (!mPlayerVod.isplay)
			{
				try{
					mPlayerVod.ShowMovie(1);//关闭广告画面
					mPlayerVod.mdivPlay.style.backgroundPosition='0% -33px';
					mPlayerVod.player.controls.play();
					mPlayerVod.player.controls.play();
					mPlayerVod.isplay=true;
				}catch(err){}
				return ;
			}
			if(mPlayerVod.mdivPlay.style.backgroundPosition=='0% -33px')
			{
				try{
					mPlayerVod.mdivPlay.style.backgroundPosition='0 0';
					mPlayerVod.player.controls.pause();
				}catch(err){}
			}
			else
			{
				try{
					mPlayerVod.mdivPlay.style.backgroundPosition='0% -33px';
					mPlayerVod.player.controls.play();
				}catch(err){}
			}
		}
		//停止
		this.mdivStop.onclick=function()
		{
			try{
				mPlayerVod.isplay = false;
				mPlayerVod.mdivPlay.style.backgroundPosition='0 0';
				mPlayerVod.player.controls.stop();
				mPlayerVod.ShowMovie(3);
			}catch(err){}
		}
		//this.SetVolume(curVolumeBar.GetPos());//设置初始声音
		this.mdivTime.innerHTML = "";//播放时间显示
		document.getElementById("ctrlPanel").style.display="block";
		document.getElementById("track").style.display="block";//进度条隐藏
		this.ShowMovie(false);//显示广告画面
	},
	//获取播放状态
	GetStatus:function()
	{
		return this.player.playState;
	},
	//获取总长度
	GetLen:function()
	{
		return curPlayer.player.CurrentMedia.duration*1000;
	},
	//当前播放长度
	GetPos:function()
	{
		return this.player.controls.CurrentPosition*1000;
	},
	//设置播放地址并开始播放
	SetInfo:function(info)
	{
		try{
			this.mdivInfo.innerHTML = info;
		}catch(err){}
	},
	//设置声音
	SetVolume:function(v)
	{
		try{
			this.player.settings.volume=parseInt(v,10);
			return true;
		}catch(err){return false;}
	},
	//是否显示节目画面，true 为显示节目画面，false为显示广告画面
	ShowMovie:function(show)
	{
		if(show==1)
		{
			if (this.mdivReady.style.display != "none")
			{
				this.mdivReady.style.display = "none";
				this.mdivScreen.style.display = "block";
			}
			if(this.mdivAd.style.display!="none")
			{
				this.mdivScreen.style.display = "block";
				this.mdivAd.style.display = "none";
			}
		}
		else if (show==2)
		{
			if (this.mdivReady.style.display != "none")
			{
				this.mdivReady.style.display = "none";
			}
			if(this.mdivAd.style.display != "block")
			{
				this.mdivScreen.style.display = "none";
				this.mdivAd.style.display = "block";
			}
		}
		else if (show==3)
		{
			this.mdivAd.style.display = "none";
			this.mdivScreen.style.display = "none";
			this.mdivReady.style.display = "block";
		}
	},
	Monitor:function()
	{
		var state = this.GetStatus();
		this.SetInfo(this.stateStr[state])
		if(state==3)
		{
			this.ShowMovie(true);
		}
		if(this.isvod)
		{
			try
			{
				var lPos = this.GetPos();//当前位置
				var lLen = this.GetLen();//长度
				if(lLen==0)
				lLen=1;
				else
				this.mdivTime.innerHTML = formatTime(lPos)+' / '+formatTime(lLen);
				var percent = lPos/lLen*100 + "%";
				testBarP.SetPos(percent);
				testBarP.SetNow(percent);
			}catch(err){}
		}
	}
};
var rPlayerVod = {//点播realplayer播放对象
	Delete:function(){
		try
		{
			if(this.timerRunning)
			{
				clearInterval(this.m_time);
				this.timerRunning = false;
			}
			this.mdivStop.onclick();
			this.player=null;
		}catch(err){}
		try{this.mdivScreen.innerHTML="";}catch(err){}
	},
	Init:function(url,pwidth,pheight){
		this.playerType="temp.rm";
		this.isvod = true;
		this.mdivScreen = document.getElementById("ready");
		this.mdivReady = document.getElementById("stopdiv");
		this.mdivAd = document.getElementById("playing");
		this.mdivTime = document.getElementById("percent");
		this.mdivPlay =document.getElementById("play");
		this.mdivStop = document.getElementById("stop");
		this.mdivInfo = document.getElementById("msg");
		this.mdivSound = document.getElementById("mute");
		this.mdivFullScreen = document.getElementById("fullScreen");
		this.stateStr = ["高清视频技术演示","正在链接","正在缓冲","正在播放《"+channelname+"》","播放暂停","正在定位"];
		this.m_time=null;
		this.timerRunning = false;
		var str = '';
		str += '<object id="player" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="'+pwidth+'" height="'+pheight+'">';
		str += '<param name="SRC" value="about:blank">';
		str += '<param name="CONTROLS" value="Imagewindow">';
		str += '<param name="CONSOLE" value="clip1">';
		str += '<param name="LOOP" value="0">';
		str += '<param name="NUMLOOP" value="0">';
		str += '<param name="BACKGROUNDCOLOR" value="#000000">';
		str += '<param name="SCRIPTCALLBACKS" value="ALL">';
		str += '<param name="ImageStatus" value="false">';
		str += '</object>';
		this.mdivScreen.innerHTML = str;
		this.player =  document.getElementById("player");
		this.player.SetSource(url);
		this.player.DoPlay();
		try
		{
			this.m_time = setInterval('curPlayer.Monitor()',1000);
			this.timerRunning = true;
		}catch(err){}
		//全屏
		this.mdivFullScreen.onclick=function()
		{
			try{
				rPlayerVod.player.SetFullScreen();
			}catch(err){}
		}
		//静音
		this.mdivSound.onclick=function()
		{
			if (rPlayerVod.player.settings.mute) {rPlayerVod.mdivSound.style.backgroundPosition='0% -68px';}else{rPlayerVod.mdivSound.style.backgroundPosition='0% -308px';}
			rPlayerVod.player.SetMute(!rPlayerVod.player.GetMute());
		}
		//播放
		this.mdivPlay.onclick=function()
		{
			if(rPlayerVod.mdivPlay.style.backgroundPosition=='0% -33px')
			{
				try{
					rPlayerVod.mdivPlay.style.backgroundPosition='0 0';
					rPlayerVod.player.DoPause();
				}catch(err){}
			}
			else
			{
				try{
					rPlayerVod.mdivPlay.style.backgroundPosition='0% -33px';
					rPlayerVod.player.DoPlay();
				}catch(err){}
			}
		}
		//停止
		this.mdivStop.onclick=function()
		{
			try{
				rPlayerVod.mdivPlay.style.backgroundPosition='0 0';
				rPlayerVod.player.DoStop();
				rPlayerVod.ShowMovieStop();
			}catch(err){}
		}
		//this.SetVolume(curVolumeBar.GetPos());//设置初始声音
		this.mdivTime.innerHTML = "";//播放时间显示
		document.getElementById("ctrlPanel").style.display="block";
		document.getElementById("track").style.display="block";//进度条隐藏
		this.ShowMovie(false);//显示广告画面
	},
	GetStatus:function()
	{
		return this.player.GetPlayState();
	},
	//获取总长度
	GetLen:function()
	{
		return this.player.GetLength();
	},
	//当前播放长度
	GetPos:function()
	{
		return this.player.GetPosition();
	},
	//设置播放地址并开始播放
	SetInfo:function(t)
	{
		try{
			this.mdivInfo.innerHTML = t;
		}catch(err){}
	},
	//设置声音
	SetVolume:function(v)
	{
		try{
			this.player.SetVolume(parseInt(v,10));
			return true;
		}catch(err){return false;}
	},
	//是否显示节目画面，true 为显示节目画面，false为显示广告画面
	ShowMovie:function(show)
	{
		this.mdivReady.style.display = "none";
		if(show)
		{
			if(this.mdivAd.style.display!="none")
			{
				this.mdivScreen.style.display = "block";
				this.mdivAd.style.display = "none";
			}
		}
		else
		{
			if(this.mdivAd.style.display != "block")
			{
				this.mdivScreen.style.display = "none";
				this.mdivAd.style.display = "block";
			}
		}
	},
	ShowMovieStop:function()
	{
		this.mdivAd.style.display = "none";
		this.mdivScreen.style.display = "none";
		this.mdivReady.style.display = "block";
	},
	Monitor:function()
	{
		var state = this.GetStatus();
		this.SetInfo(this.stateStr[state])
		if(state==3)
		{
			this.ShowMovie(true);
		}
		if(this.isvod)
		{
			try
			{
				var lPos = this.GetPos();//当前位置
				var lLen = this.GetLen();//长度
				if(lLen==0)
				lLen=1;
				else
				this.mdivTime.innerHTML = formatTime(lPos)+' / '+formatTime(lLen);
				var percent = lPos/lLen*100 + "%";
				testBarP.SetPos(percent);
				testBarP.SetNow(percent);
			}catch(err){}
		}
	}
};
var mFlvPlayer = {
	Delete:function(){
		try
		{
			if(this.timerRunning)
			{
				clearInterval(this.m_time);
				this.timerRunning = false;
			}
		}catch(err){}
//		try{this.player.videoStop}catch(err){}
//		try{this.player.sendEvent('STOP')}catch(err){}
//		try{this.player=null;}catch(err){}
		try{this.mdivScreen.innerHTML="";}catch(err){}
	},
	Init:function(url,pwidth,pheight){
		this.flashloading='<object type="application/x-shockwave-flash" data="../images/icon_loading.swf" width="320" height="80"><param name="movie" value="../images/icon_loading.swf"/><param name="menu" value="false" /></object>';
		this.flvurl=url;
		this.isplay=true;
		this.mute=false;
		this.volume=.7;
		this.playerType="temp.flv";
		this.isvod = true;
		this.mdivScreen = document.getElementById("ready");
		this.mdivReady = document.getElementById("stopdiv");
		this.mdivAd = document.getElementById("playing");
		this.mdivTime = document.getElementById("percent");
		this.mdivPlay =document.getElementById("play");
		this.mdivStop = document.getElementById("stop");
		this.mdivInfo = document.getElementById("msg");
		this.mdivSound = document.getElementById("mute");
		this.mdivFullScreen = document.getElementById("fullScreen");
//		url='http://192.168.1.76:8080/220B1FD1E42CC6250D75C9315637A71DBD4B2D4665436DD958E7D60AB22BDC42C353BAFFA35FEC4BB0B515803AB7A29B69D587615E7688381408382966B4A0FF83AB530F39B30BD522EF619FC2DFEF1C327280FA40D6E8FCB135ABA3364A8009EB387E59E49875B56B900A7779BEF59A3835EE304ED00F05D41366A9DD8DD6829BC217611AF146A0C0333DEBF8E049C15B78A49BC0180DB0DF064ED0D662049852BC9148B45D82FDA264AC5A0113A15513A26D1D66CD6D1F46820C1A82163A53AFAEA7B46DA36DEE443027334CE8D869172DFCE80AE5F71E86D2377KDLR9UOXVTVDNP/xbox-1-1.flv';

//		document.getElementById("ready").innerHTML='<object type="application/x-shockwave-flash" data="script/swf/SvPlayer.swf" width="'+pwidth+'" height="'+pheight+'" id="SvPlayer"><param name="movie" value="script/swf/SvPlayer.swf"/><param name="allowFullScreen" value="true" /><param name="menu" value="false" /><param name="FlashVars" value="xml=<SvPlayer><channel><item><source>'+encodeURI(url)+'</source></item></channel><plugIns><javaScriptPlugIn><url>script/swf/javaScriptPlugIn.swf</url></javaScriptPlugIn></plugIns></SvPlayer>"/></object>';
		this.playerstr = new SWFObject("../script/swf/SvPlayer.swf","lizux",pwidth,pheight,"9","#FFFFFF");
		this.playerstr.addParam("allowfullscreen","true");
		this.playerstr.addParam("allowscriptaccess","always");
		//this.playerstr.addParam("flashvars","autostart=true&&streamer=lighttpd&titlebar=none&file="+url);
		this.playerstr.addParam("flashvars","autostart=true&image=preview.jpg&subtitle=&type=video&file="+url);
		this.playerstr.write("ready");
		this.playerstr = null;
		this.player = document.getElementById("SvPlayer");
		//document.getElementById('SvPlayer').playPause();
		//|//document.getElementById("ctrlPanel").style.display="none";
		//|//this.mdivPlay.style.backgroundPosition='0% -33px';

		//播放
		/*this.mdivPlay.onclick=function()
		{
			if (!mFlvPlayer.isplay)
			{
				try{
					document.location.reload();
				}catch(err){}
				return ;
			}
//			mFlvPlayer.ShowMovie(1);
			//if (!this.isplay) {document.getElementById("ready").innerHTML='<object type="application/x-shockwave-flash" data="script/swf/SvPlayer.swf" width="'+pwidth+'" height="'+pheight+'" id="SvPlayer"><param name="movie" value="script/swf/SvPlayer.swf"/><param name="allowFullScreen" value="true" /><param name="menu" value="false" /><param name="FlashVars" value="xml=<SvPlayer><channel><item><source>'+this.flvurl+'</source></item></channel><plugIns><javaScriptPlugIn><url>script/swf/javaScriptPlugIn.swf</url></javaScriptPlugIn></plugIns></SvPlayer>"/></object>';}
			if(mFlvPlayer.mdivPlay.style.backgroundPosition=='0% -33px')
			{
				try{
					mFlvPlayer.mdivPlay.style.backgroundPosition='0 0';
					document.getElementById('SvPlayer').playPause();
				}catch(err){}
			}
			else
			{
				try{
					mFlvPlayer.mdivPlay.style.backgroundPosition='0% -33px';
					document.getElementById('SvPlayer').playPause();
				}catch(err){}
			}
		}*/
		//停止
		/*this.mdivStop.onclick=function()
		{
			try{
				mFlvPlayer.mdivPlay.style.backgroundPosition='0 0';
				document.getElementById('SvPlayer').videoStop();
				//document.getElementById("ready").innerHTML='<object type="application/x-shockwave-flash" data="script/swf/SvPlayer.swf" width="'+pwidth+'" height="'+pheight+'" id="SvPlayer"><param name="movie" value="script/swf/SvPlayer.swf"/><param name="allowFullScreen" value="true" /><param name="menu" value="false" /><param name="FlashVars" value="xml=<SvPlayer><channel><item><source></source></item></channel><plugIns><javaScriptPlugIn><url>script/swf/javaScriptPlugIn.swf</url></javaScriptPlugIn></plugIns></SvPlayer>"/></object>';
				mFlvPlayer.isplay=false;
				//document.getElementById('SvPlayer').playPause();
				mFlvPlayer.ShowMovie(3);
			}catch(err){}
		}*/
		//静音
		/*this.mdivSound.onclick=function()
		{
			if (mFlvPlayer.mute)
			{
				mFlvPlayer.mdivSound.style.backgroundPosition='0% -68px';
				document.getElementById('SvPlayer').volumeTo(mFlvPlayer.volume);
				mFlvPlayer.mute = false;
			}
			else
			{
				mFlvPlayer.mdivSound.style.backgroundPosition='0% -308px';
				document.getElementById('SvPlayer').volumeTo(0);
				mFlvPlayer.mute = true;
			}
//			if (mFlvPlayer.player.settings.mute) {mFlvPlayer.mdivSound.style.backgroundPosition='0% -68px';}else{mFlvPlayer.mdivSound.style.backgroundPosition='0% -308px';}
//			mFlvPlayer.player.settings.mute=!mFlvPlayer.player.settings.mute;
		}*/

		this.ShowMovie(1);//显示广告画面
	},
	//设置播放地址并开始播放
	SetInfo:function(t)
	{
		try{
			//this.player.URL = url;
			//this.player.controls.play();
			this.mdivInfo.innerHTML = curPlayer.t;
		}catch(err){}
	},
	//设置播放地址并开始播放
	SetInfo:function(info)
	{
		try{
			this.mdivInfo.innerHTML = info;
		}catch(err){}
	},
	GetStatus:function()
	{
		return 3;
	},
	//设置声音
	SetVolume:function(v)
	{
		try{
			this.player.volumeTo(parseInt(v,10)/100);
			this.mutevol=parseInt(v,10)/100;
			return true;
		}catch(err){return false;}
	},
	//是否显示节目画面，true 为显示节目画面，false为显示广告画面
	ShowMovie:function(show)
	{
		if(show==1)
		{
			/*if (this.mdivAd.innerHTML!='')
			{
				this.mdivAd.innerHTML='';
//				this.mdivScreen.style.display = "block";
			}*/
			if (this.mdivReady.style.display != "none")
			{
				this.mdivReady.style.display = "none";
			}
			if(this.mdivAd.style.display!="none")
			{
				this.mdivScreen.style.display = "block";
				this.mdivAd.style.display = "none";
			}
		}
		else if (show==2)
		{
			/*if (this.mdivAd.innerHTML=='')
			{
				alert('asdfsf');
				this.mdivAd.innerHTML=this.flashloading;
//				this.mdivAd.style.display = "block";
			}*/
			if (this.mdivReady.style.display != "none")
			{
				this.mdivReady.style.display = "none";
			}
			if(this.mdivAd.style.display != "block")
			{
				this.mdivAd.style.display = "block";
				this.mdivScreen.style.display = "none";
			}
		}
		else if (show==3)
		{
			this.mdivAd.style.display = "none";
			this.mdivScreen.style.display = "none";
			this.mdivReady.style.display = "block";
		}
	}
};
var mTsFlvPlayer = {
		Delete:function(){
			try
			{
				if(this.timerRunning)
				{
					clearInterval(this.m_time);
					this.timerRunning = false;
				}
			}catch(err){}
//			try{this.player.videoStop}catch(err){}
//			try{this.player.sendEvent('STOP')}catch(err){}
//			try{this.player=null;}catch(err){}
			try{this.mdivScreen.innerHTML="";}catch(err){}
		},
		Init:function(url,tsurl,pwidth,pheight){
			this.flashloading='<object type="application/x-shockwave-flash" data="images/icon_loading.swf" width="320" height="80"><param name="movie" value="images/icon_loading.swf"/><param name="menu" value="false" /></object>';
			this.flvurl=url;
			this.isplay=true;
			this.mute=false;
			this.volume=.7;
			this.playerType="temp.flv";
			this.isvod = true;
			this.mdivScreen = document.getElementById("ready");
			this.mdivReady = document.getElementById("stopdiv");
			this.mdivAd = document.getElementById("playing");
			this.mdivTime = document.getElementById("percent");
			this.mdivPlay =document.getElementById("play");
			this.mdivStop = document.getElementById("stop");
			this.mdivInfo = document.getElementById("msg");
			this.mdivSound = document.getElementById("mute");
			this.mdivFullScreen = document.getElementById("fullScreen");
//			url='http://192.168.1.76:8080/220B1FD1E42CC6250D75C9315637A71DBD4B2D4665436DD958E7D60AB22BDC42C353BAFFA35FEC4BB0B515803AB7A29B69D587615E7688381408382966B4A0FF83AB530F39B30BD522EF619FC2DFEF1C327280FA40D6E8FCB135ABA3364A8009EB387E59E49875B56B900A7779BEF59A3835EE304ED00F05D41366A9DD8DD6829BC217611AF146A0C0333DEBF8E049C15B78A49BC0180DB0DF064ED0D662049852BC9148B45D82FDA264AC5A0113A15513A26D1D66CD6D1F46820C1A82163A53AFAEA7B46DA36DEE443027334CE8D869172DFCE80AE5F71E86D2377KDLR9UOXVTVDNP/xbox-1-1.flv';

//			document.getElementById("ready").innerHTML='<object type="application/x-shockwave-flash" data="script/swf/SvPlayer.swf" width="'+pwidth+'" height="'+pheight+'" id="SvPlayer"><param name="movie" value="script/swf/SvPlayer.swf"/><param name="allowFullScreen" value="true" /><param name="menu" value="false" /><param name="FlashVars" value="xml=<SvPlayer><channel><item><source>'+encodeURI(url)+'</source></item></channel><plugIns><javaScriptPlugIn><url>script/swf/javaScriptPlugIn.swf</url></javaScriptPlugIn></plugIns></SvPlayer>"/></object>';
			this.playerstr = new SWFObject("script/swf/TVplayer.swf","lizux",pwidth,pheight,"9","#FFFFFF");
			this.playerstr.addParam("allowfullscreen","true");
			this.playerstr.addParam("allowscriptaccess","always");
			this.playerstr.addParam("flashvars","autostart=true&type=live&timeshift=2&streamer="+url+"&file="+tsurl);
			this.playerstr.write("ready");

			this.playerstr = null;
			this.player = document.getElementById("SvPlayer");
			//document.getElementById('SvPlayer').playPause();
			//|//document.getElementById("ctrlPanel").style.display="none";
			//|//this.mdivPlay.style.backgroundPosition='0% -33px';

			this.ShowMovie(1);//显示广告画面
		},
		//设置播放地址并开始播放
		SetInfo:function(t)
		{
			try{
				//this.player.URL = url;
				//this.player.controls.play();
				this.mdivInfo.innerHTML = curPlayer.t;
			}catch(err){}
		},
		//设置播放地址并开始播放
		SetInfo:function(info)
		{
			try{
				this.mdivInfo.innerHTML = info;
			}catch(err){}
		},
		GetStatus:function()
		{
			return 3;
		},
		//设置声音
		SetVolume:function(v)
		{
			try{
				this.player.volumeTo(parseInt(v,10)/100);
				this.mutevol=parseInt(v,10)/100;
				return true;
			}catch(err){return false;}
		},
		//是否显示节目画面，true 为显示节目画面，false为显示广告画面
		ShowMovie:function(show)
		{
			if(show==1)
			{
				/*if (this.mdivAd.innerHTML!='')
				{
					this.mdivAd.innerHTML='';
//					this.mdivScreen.style.display = "block";
				}*/
				if (this.mdivReady.style.display != "none")
				{
					this.mdivReady.style.display = "none";
				}
				if(this.mdivAd.style.display!="none")
				{
					this.mdivScreen.style.display = "block";
					this.mdivAd.style.display = "none";
				}
			}
			else if (show==2)
			{
				/*if (this.mdivAd.innerHTML=='')
				{
					alert('asdfsf');
					this.mdivAd.innerHTML=this.flashloading;
//					this.mdivAd.style.display = "block";
				}*/
				if (this.mdivReady.style.display != "none")
				{
					this.mdivReady.style.display = "none";
				}
				if(this.mdivAd.style.display != "block")
				{
					this.mdivAd.style.display = "block";
					this.mdivScreen.style.display = "none";
				}
			}
			else if (show==3)
			{
				this.mdivAd.style.display = "none";
				this.mdivScreen.style.display = "none";
				this.mdivReady.style.display = "block";
			}
		}
	}
